import router from "./index" ;
import Vue from 'vue';
import VueRouter from 'vue-router';
import layout from "#/components/layout/layout";

Vue.use(VueRouter);
const {Api,Demos,Others} = router;
const routers = [
    {
        path: '/login',
        name: 'login',
        component: (resolve) => require(['#/index.vue'], resolve),
    },
    {
        path: '/',
        redirect:"/index",
        component:(resolve) => require(['#/components/layout/index.vue'], resolve),
        children:[
            {
                path: '/index',
                name: 'index',
                component: (resolve) => require(['#/index.vue'], resolve),
            },
            {
                path: '/Demos',
                redirect: '/Demos/2019116',
                component:layout,
                children:Demos
            },
            {
                path: '/Api',
                redirect: '/Api/20191181402',
                component:layout,
                children:Api
            },
            {
                path: '/Others',
                redirect: '/Others/importDir',
                component:layout,
                children:Others
            },
            {
                path: '*',
                redirect: '/index',
            },
        ]
    },
    {
        path: '*',
        redirect: '/index',
    }
]
export default new  VueRouter({
    mode: 'history',
    // base:'/test/',
    routes: routers
});